﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestAfSQL
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            DBMovie dbm = new DBMovie();
            DBSeat dbseat = new DBSeat();
            DBShowTime dbshow = new DBShowTime();
            DBTicket dbt = new DBTicket();
            DBBooking dbb = new DBBooking();
            DBCinemaRoom dbcr = new DBCinemaRoom();
            DBCustomer dbcust = new DBCustomer();

            List<Seat> seats = new List<Seat>();
            List<CinemaRoom> croom = new List<CinemaRoom>();
            List<Movie> movies = new List<Movie>();
            //Seat seatToInsert = new Seat(3,7,50,false,false,10);
            //Console.WriteLine(stuff.Insert(seatToInsert));
            //Seat seat = stuff.ReadSeat(100307);
            //Console.WriteLine(seat.ToString());
            //seatToInsert.Price = 95;
            //Console.WriteLine(stuff.Update(seatToInsert));
            

            movies.Add(new Movie("This is Sparta!", "This is a movie where a guy kicks another guy into a massive hole.", 80, false, 90, 10, 10, ""));
            foreach (var movie in movies)
            {
                if (dbm.Read(movie.Title) == null)
                {
                    Console.WriteLine(dbm.Insert(movie));
                }
                else
                {
                    Console.WriteLine("Fuck off!");
                }
            }

            foreach (var movie in dbm.ReadAll())
            {
                Console.WriteLine("Title: " + movie.Title + "\nDescription: " + movie.Description);
            }

            dbm.Update(new Movie("Bourne Identity",
                                 "A man is picked up by a fishing boat, bullet-riddled and without memory, then races to elude assassins and recover from amnesia.",
                                 90, false, 90, 10, 10, ""));

            Console.WriteLine(dbcust.Insert("88888888","Leasy","peter@leasy.dk"));
            Console.WriteLine(dbcust.Read("8888888").First().Name);
            foreach (var customer in dbcust.ReadAll())
            {
                Console.WriteLine("Name: {0} Phone: {1} Mail: {2}", customer.Name, customer.PhoneNo, customer.Email);
            }








            Console.ReadLine();

            //SQLStuff stuff = new SQLStuff();


            //Seat seatToInsert = new Seat(3, 7, 50, false, false, 1);
            //Console.WriteLine(stuff.Insert(seatToInsert));
            //Seat seat = stuff.ReadSeat(10307);
            //Console.WriteLine(seat.ToString());
            //seatToInsert.Price = 95;
            //Console.WriteLine(stuff.Update(seatToInsert));

            //Console.WriteLine(
            //    stuff.InsertShowTime(new ShowTime(DateTime.Parse("11/11-13, 13:30"), new Movie("something", 10),
            //                                      new CinemaRoom(1))));

            //List<Seat> seats = stuff.ReadAllSeats();
            //List<Customer> cust = (stuff.Read("88888888"));

            //foreach (var se in seats)
            //{
            //    Console.WriteLine(se.ToString());
            //}


            //Console.WriteLine();
            //Console.WriteLine(stuff.Delete(new Seat(3, 7, 10)));
            //foreach (var se in stuff.ReadAllSeats())
            //{
            //    Console.WriteLine(se.ToString());
            //}

            //Console.WriteLine("Showtime by movie:");
            //foreach (var sht in stuff.ReadShowTime(new Movie("Master and", 20)))
            //{
            //    Console.WriteLine(sht.DateTime.ToString());
            //}

            //Console.WriteLine("Showtime by room");
            //foreach (var sht in stuff.ReadShowTime(new CinemaRoom(1)))
            //{
            //    Console.WriteLine(sht.DateTime.ToString() + " " + sht.Movie.Title);
            //}

            //Console.WriteLine("Showtime by date");
            //foreach (var sht in stuff.ReadShowTime(DateTime.Parse("11/11-13")))
            //{
            //    Console.WriteLine(sht.DateTime.ToString());
            //}

            //Console.WriteLine(cust[0].Name);
            //Console.ReadLine();
        }
    }

}